﻿using System;
using System.Net;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Documents;
using System.Windows.Ink;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Animation;
using System.Windows.Shapes;

namespace DAO
{
    public class GlobalDatabase
    {
        public const string ConnectString = "Data Source='/data.sdf'; File Mode = Read Only;";

        // tao database.
        public static void createDatabase()
        {

            using (var datacontext = new DataContext(ConnectString))
            {
                if (!datacontext.DatabaseExists())
                {
                    // tao database neu no con chua ton tai.
                    datacontext.CreateDatabase();
                }
            }
        }


        //xoa database
        public static void deleteDatabase()
        {
            using (var datacontext = new DataContext(ConnectString))
            {
                if (datacontext.DatabaseExists())
                {
                    // neu database ton tai thi moi xoa.
                    datacontext.DeleteDatabase();
                }
            }
        }

    }
}
